import React,{Component} from 'react';
import {Button,ActivityIndicator,View} from 'react-native';

export default class Demo21Component extends Component{
  constructor(){
    super();
    this.state = {
      isLoading:false
    };
  }

  handlePress=()=>{
    this.setState({
      isLoading:true
    })
  }

  render(){
    return <View>
      <Button  
      onPress={this.handlePress}
      title='加载数据'></Button>
      {
        this.state.isLoading
        &&
        <ActivityIndicator>
        </ActivityIndicator>
      }
    </View>
  }

}